#pragma once
#include "Car.h"
#include "ParkingLot.h"
#include "tracker.h"
#include <iostream> 
#include <map>
#include <string>
#include <fstream>
using namespace std;

class ParkinglotDB
{
private:
	std::map <int,Car> Car_list;
	std::map <int,Car>::iterator it; 

	std::map <int,ParkingLot> ParkingLot_list;
	std::map <int,ParkingLot>::iterator Lotit; 

	ParkinglotDB(void){};
	~ParkinglotDB(void){};

	std::map<int, Car>::iterator FindCar(int license_plate);
public:
	void InitLot();//Initialization of the parking lot

	// this is how you get the singleton object:
	static ParkinglotDB &instance (void)
	{
		static ParkinglotDB inst;
		return inst;
	}
	void CarEntered(int car_id);			/*this will generate a new car in the parking lot*/
	void CarExits(int car_id);				/*this will delete a car from the parking lot*/
	int IsParkingAvailble(int parking_id); /* return -1 if parking number parking_id is free, else retruns LP of the parking car*/
	bool SetLicensePlate (int car_id, int license_plate);/*sets the license plate of an existing car, returns false if car_id is not in the database*/
	bool CarParked (int car_id, int x, int y); 	/*sets the parking place of an existing car, returns false if car_id is not in the database */
	int CarUnparked(int x, int y);			/*returns the car_id of the car in the parking place of (x,y), and updating the database accordingly*/
	int WhereIsMyCar(int license_plate);	/*returns some description of the car location , -2 if no such car, -1 if not parking yet (traveling)*/ 
	void PrintOccupiedSpots();				/*prints the occupied parking places*/ 
	string WhenEntered(int license_plate);	/*returns the time , when an existing car has entered*/ 
	void PrintLogToFile();					/* prints log to TXT file the describes for every parking is it empty or who parking there, and when he entered to the parking lot*/
	bool isThisParkingSlot(int x, int y);	/*return true if the current location is a parking space*/
};

/*
// this class implements the database of our parking lot.
// --- responsibility: Dima & Roey.

class ParkinglotDB
{
ParkinglotDB(void)
~ParkinglotDB(void);
public:
// this is how you get the singelton object:
static ParkinglotDB &instance (void) {
static ParkinglotDB inst;
return inst;
}

// example function (remove later), to demonstrate use in main_top.
//bool example (void) { return true; }

// IMPORTANT:
// First things you MUST do are defining a CAR class (with definitions like what type is
// a license plate number - long, double, etc? and all other data you need for a car - where it parks etc)
// and define all the interfaces to you - what are the function you need, and what types exactly they
// should get and return.
};
*/

